package com.hanter.demo.raddemo

import android.os.Bundle
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProviders
import com.hanter.android.radui.mvvm.BaseViewModel
import com.hanter.android.radui.mvvm.MvvmTitleBarActivity
import com.hanter.demo.raddemo.databinding.ActivityTestBinding

class TestActivity : MvvmTitleBarActivity() {

    private lateinit var viewBinding: ActivityTestBinding
    private lateinit var viewModel: TestViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initViews()
    }

    override fun initViewModel(): BaseViewModel {
        viewModel = ViewModelProviders.of(this).get(TestViewModel::class.java)
        viewBinding = DataBindingUtil.setContentView(this, R.layout.activity_test)
        viewBinding.setLifecycleOwner(this)
        viewBinding.viewModel = viewModel
        return viewModel
    }

    private fun initViews() {
        titleBarHelper.title.text = "test"
    }

}
